<%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page import = "com.db4o.servlet.Db4oServlet" %>
<%@page import = "facades.*" %>
<%@page import = "auser.*" %>
<%@page import = "com.db4o.query.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet"  href="<%=request.getContextPath()%>/css/printpreview.css" type="text/css" media="screen" />
<link rel="stylesheet"  href="<%=request.getContextPath()%>/css/print.css" type="text/css" media="print" />
<script src="<%=request.getContextPath()%>/js/jquery.js"></script>
<title>Stampa Elenco Soggetti Accompagnati</title>

</head>
<body>
<% 	SessionFacade sfacade = new SessionFacade(session);  
	Query qu = sfacade.newQuery(SoggettoAccompagnato.class);  
	Utente utente = (Utente)session.getAttribute("userBean");  
	
	if(request.getParameter("tipo")!=null  && !request.getParameter("tipo").equals("")) 
		qu.descend("tipo").constrain(request.getParameter("tipo") );   
	
  	qu.descend("circolo").constrain(utente.getCircolo());  
	qu.descend("cognome").orderAscending().descend("nome").orderAscending();  
%>	
	
<table>
	<thead> 
		<tr class='noprint'><th colspan="6">${param.tipo}
				<form method="get" action="prn_elenco.jsp">
				<a href='<%=request.getContextPath() %>/app/start/index.jsp'>Chiudi</a> 
				|<a href='javascript:print()'>Stampa</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				
					Tipo 	<select name="tipo" id="tipo">
								<option value="" ${param.tipo==''?'selected':''}>Tutti	
								<option value="disabile" ${param.tipo=='disabile'?'selected':''}>Disabile	
								<option value="anziano"  ${param.tipo=='anziano'?'selected':''}>Anziano	
								<option value="altro"    ${param.tipo=='altro'?'selected':''}>Altro	
							</select> 
							<input type="submit" value="Cerca" />
				</form>		
		<tr><th colspan="6"><div class="logo">Elenco Soggetti Accompagnati -  ${userBean.circolo.descrizione} </div>	
		
		<tr><th>Tipo
			<th style="width:5cm">Cognome e Nome
			<th style="width:4cm">Indirizzo	 
			<th>Anno
			<th>Telefono 
			<th>Persona diversa  
	</thead>  
	<tbody>
		<c:forEach items="<%=qu.execute()%>" var="sog" varStatus="status">
			 
			<tr style="vertical-align:top"><td>${sog.tipo}   &nbsp;&nbsp;
				<td>${sog.cognome} ${sog.nome}  &nbsp;&nbsp;
				<td>${sog.indirizzo}<br>${sog.comune}&nbsp;&nbsp;
				<td>${sog.annoNascita}&nbsp;
				<td>${sog.telefono}&nbsp; 
				<td>${sog.personaDiversa}&nbsp; <br>
					${sog.telPersonaDiversa}
	  
		</c:forEach> 
	</tbody>	
</table>	
</body>	
</html>